<template>
    <a-button @click="countDown">
      5秒自动关闭
    </a-button>
  </template>
  <script>
  export default {
    methods: {
      countDown() {
        let secondsToGo = 5;
        const modal = this.$success({
          title: '这是一条提示信息',
          content: `对话框即将在${secondsToGo} 秒后关闭.`,
        });
        const interval = setInterval(() => {
          secondsToGo -= 1;
          modal.update({
            content: `对话框即将在${secondsToGo} 秒后关闭.`,
          });
        }, 1000);
        setTimeout(() => {
          clearInterval(interval);
          modal.destroy();
        }, secondsToGo * 1000);
      },
    },
  };
  </script>
  